function call_rpc(rpc_name, param_arr, call_back_func) {
    param_arr["rpc_name"] = rpc_name;
    $.post("/accHestia/src/svr/com/rpc_entry.php",
        {req_param:param_arr},
        function(data, status){
            if ("success" == status) {
                try {
                    var ps_data = JSON.parse(data);
                    if("undefined" != typeof(ps_data["console_log"])) {
                        if ("OK" == ps_data["result"]) {
                            //console.log("[OK][req:%s][action:%s] %s", ps_data["rpc_req_name"], ps_data["rpc_acttion_name"], ps_data["console_log"]);
                        } else {
                            console.log("[NG][req:%s][action:%s] %s", ps_data["rpc_req_name"], ps_data["rpc_acttion_name"], ps_data["console_log"]);
                        }
                    }
                    if(typeof call_back_func == 'function') {
                        call_back_func(ps_data);
                    } else {
                        if ("OK" == ps_data["result"]) {
                            console.log("[default rpc callback] result OK.");
                        } else {
                            if("undefined" != typeof(ps_data["err_msg_display"])) {
                                alert(ps_data["err_msg_display"]);
                            } else {
                                alert("[def cb] Failed!");    
                            }
                        }
                    }
                } catch(err) {
                    if("string" == typeof(data)) {
                        console.log("%s", err.name + " - " + err.message + "\n" + err.stack + "\ndata:" + data);
                    } else {
                        console.log("%s", err.name + " - " + err.message + "\n" + err.stack);
                    }
                    alert("[try] Failed!");
                    if(!$("#rpc_debug_err").length) {
                        $("body").append("<div id='rpc_debug_err'></div>");
                    }
                    $("#rpc_debug_err").html(data);
                }
            } else {
                alert("[net transfer] Failed!");
            }
        }
    );
}

//after_data_geted is object or func
//object: the geted data is seted to after_data_geted.data(cause of NOT-Referencable param)
function acc_load_data(ld_descriptor, after_data_geted) {
    call_rpc("load_acc_data", {descriptor:ld_descriptor}, function(ps_data) {
        if(typeof after_data_geted == 'function') {
            after_data_geted(ps_data);
        } else {
            if ("OK" == ps_data["result"]) {
                after_data_geted.data = JSON.parse(ps_data["data"]);
            } else {
                alert(ps_data["err_msg_display"] || "Internal Error! load data failed: " + ld_descriptor);
            }
        }
    });
}

function com_show_err(ps_data) {
    if("undefined" != typeof(ps_data["err_msg_display"])) {
        alert(ps_data["err_msg_display"]);
    } else {
        alert("Internal Error!");    
    }
    if("undefined" != typeof ps_data["err_focus_in_type"]) {
        if("not_grid" == ps_data["err_focus_in_type"]) {
            var focus_in_id = ps_data["id_focus_in"];
            if(focus_in_id && $("#"+ focus_in_id).length) {
                setTimeout(function() {$("#"+ focus_in_id).focus();}, 50);
            }
        }
    }
}